package org.windblog.core.servlet.page;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.windblog.core.PageService;
import org.windblog.core.entity.Page;



@SuppressWarnings("serial")
public class DeletePageServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		String pagekey = req.getParameter("page").trim();
		Page page = PageService.getPage(pagekey);
		if(page!=null)
		{
			PageService.deletePage(page);
			resp.sendRedirect("/admin/editPages.jsp?message=3");
		}else{
			resp.sendRedirect("/admin/editPages.jsp?message=4");
		}
		


	}
	
}